export default ({$axios},inject)=>{
	//webpage页面
	inject('getWebPage',data=>get($axios,'/getwebpage',data));//按页获取webpage分页
	inject('getWebArticle',data=>get($axios,'/getwebarticle',data));//按文章id获取webarticle文章
	inject('getWebTypes',data=>get($axios,'/getwebtypes',data));//获取web的文章分类
	inject('getWebTags',data=>get($axios,'/getwebtags',data));//按页获取webtags分页
	inject('getWebPageByTag',data=>get($axios,'/getwebpagebytag',data));//根据tag获取文章
	inject('getWebPageByType',data=>get($axios,'/getwebpagebytype',data));//根据分类获取文章
	inject('getWebPageByViews',data=>get($axios,'/getwebpagebyviews',data));//获取阅读最多的文章
	inject('getWebPageByTime',data=>get($axios,'/getwebpagebytime',data));//获取最新发布的文章
	inject('getArticleMessage',data=>get($axios,'/getarticlemessage',data));//获取文章对应的评论
	inject('publishMessage',data=>post($axios,'/publisharticlemessage',data));//发表文章评论
	inject('searchArticle',data=>post($axios,'/searcharticle',data));//查找文章
	//home页面
	inject('getBanners',()=>get($axios,'/getbanner'));//获取轮播图信息
	inject('getSpicalColumn',()=>get($axios,'/getspicalcolumn'));//获取专栏信息
	inject('getAuthorInfo',()=>get($axios,'/getauthorinfo'));//获取用户信息
	inject('getRecommend',()=>get($axios,'/getrecommend'));//获取推荐文章
	inject('getFriendLinks',()=>get($axios,'/getfriendlinks'));//获取友情链接
	inject('getFooterInfo',()=>get($axios,'/getfooterinfo'));//获取底部信息
	inject('getSeoInfo',()=>get($axios,'/getseoinfo'));//获取seo信息
	//案例页面
	inject('getFiles',()=>get($axios,'/gethtmldir'));//获取案例文件名
}

async function get($axios,url,data = {}){
	let result = await $axios(url,{
		method:'get',
		params:{//get请求发送数据需要用params属性
			...data
		}
	});
	return result.data;
}
async function post($axios,url,data = {}) {
	let result = await $axios(url,{
		method:'post',
		data
	});
	return result.data;
}